package com.zhiyou100.blog.aciton.message;

import com.zhiyou100.blog.service.MessageService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author shkstart
 * @create 2021-10-25 20:36
 */
@WebServlet("/message/delete")
public class MessageDeleteServlet extends HttpServlet {
    private MessageService service = new MessageService();

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String mid = request.getParameter("mid");
        String tid = request.getParameter("tid");
        service.deleteMessageByMid(Integer.parseInt(mid));
//        跳转到查询的页面展示数据
        request.getRequestDispatcher("/title/showMessage?tid=" + tid).forward(request, response);
    }
}
